import fnmatch
import os
from typing import List


def is_ignored(relative_path: str, ignore_patterns: List[str]) -> bool:
    norm = relative_path.replace("\\", "/")
    if norm.startswith("./"):
        norm = norm[2:]
    # Directory rules end with '/'
    for pattern in ignore_patterns:
        if pattern.endswith('/'):
            # Match directory prefix
            dir_prefix = pattern
            if dir_prefix.startswith('./'):
                dir_prefix = dir_prefix[2:]
            if norm.startswith(dir_prefix):
                return True
        else:
            if fnmatch.fnmatch(norm, pattern):
                return True
            # Also try basename match
            if fnmatch.fnmatch(os.path.basename(norm), pattern):
                return True
    return False
